package com.songlanyun.modules.refillorder.model;

import cn.afterturn.easypoi.excel.annotation.Excel;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.songlanyun.common.drive.RootEntity;
import com.songlanyun.common.drive.ValueObject;
import com.songlanyun.common.enums.OrderConstant;
import com.songlanyun.common.enums.RefillOrderConstant;
import com.songlanyun.common.utils.custom.DateCustomUtils;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;

/**
 * 充值卡订单
 */
@Data
public class RefillCardOrderVO implements ValueObject {

    /**
     * 充值订单编号
     */
    @Excel(name = "订单号", orderNum = "1", width = 30)
    private String code;
    /**
     * 交易流水号（第三方）
     */
    @Excel(name = "交易单号", orderNum = "2", width = 30)
    private String tradeNo;
    /**
     * 支付方式
     * 1：微信
     * 2：支付宝
     */
    @Excel(name = "支付方式", orderNum = "8", replace = {"微信_1", "支付宝_2"}, width = 10)
    @NotNull(message = "支付方式不能为空")
    private Integer payMode;

    /**
     * 支付状态
     * 0未支付，
     * 1支付已提交,
     * 2支付成功，但业务发生异常需要发起退款，
     * 3支付成功，但业务发生异常自动退款成功，
     * 4支付成功，但业务发生异常自动退款失败，
     * 5支付成功，但微信返回的金额与实际支付的金额不相等
     * 6支付失败，
     * 7已支付(已支付成功)
     */
    @Excel(name = "支付状态", orderNum = "9", replace = {"待支付_0", "支付成功_7"}, width = 10)
    private Integer paymentStatus;
    /**
     * 创建的时间戳
     */
    private Long createTimeMillis;

    public void setCreateTimeMillis(Long createTimeMillis) {
        this.createTimeMillis = createTimeMillis;
        this.formatCreateTimeMillis = DateCustomUtils.formatToDateTimeString(createTimeMillis);
    }

    /**
     * 格式化创建时间
     */
    @Excel(name = "创建时间", orderNum = "11", width = 20)
    @TableField(exist = false)
    private String formatCreateTimeMillis;

    /**
     * 0未关闭，1手动关闭，2过期支付关闭
     */
    private RefillOrderConstant.CloseStatus closeStatus;

    /**
     * 交易状态（0已下单,待支付，1交易结束
     */
    @Excel(name = "订单状态", orderNum = "10", replace = {"已下单(待支付)_0", "交易结束_1"}, width = 15)
    private Integer transactionStatus;
    /**
     * 充值卡id
     */
    @NotNull(message = "转入卡不能为空")
    private Long refillCardId;
    /**
     * 充值卡名
     */
    @Excel(name = "转入卡名", orderNum = "5", width = 30)
    private String refillCardName;
    /**
     * 充值卡所需钱数
     */
    @Excel(name = "转入金额", orderNum = "6", width = 10)
    private BigDecimal refillCardMoney;
    /**
     * 额外的送多少
     */
    private BigDecimal refillCardAppend;
    /**
     * 实际支付
     */
    @Excel(name = "实际支付", orderNum = "7", width = 10)
    private BigDecimal factCost;

    /**
     * 会员id
     */
    private Long userId;


    /**
     * 聚合支付订单号
     */
    @NotBlank(message = "聚合支付订单号不能为空")
    private String payOrderCode;

    /**
     * 聚合支付订单id
     */
    @NotNull(message = "聚合支付订单id不能为空")
    private Long payOrderId;

    /**
     * 手机号
     */
    @Excel(name = "用户手机号", orderNum = "4", width = 20)
    @TableField(exist = false)
    private String mobile;

    /**
     * 昵称
     */
    @Excel(name = "用户昵称", orderNum = "3", width = 20)
    @TableField(exist = false)
    private String nickname;


}
